<template>
    <el-table
      :data="tableData"
      border
      style="width: 90%; margin: 20px auto;border-radius: 8px;box-shadow: 5px 5px 10px rgba(98, 106, 239, 0.5);"
      :header-cell-style="{
          'background': '#626aef !important',
          'color': '#ffffff',
          'border': 'none !important'
        }">
    <el-table-column prop="target" label="目标" width="180" />
      <el-table-column prop="totalScore" label="O分值" width="180" />
      <el-table-column prop="keyResult" label="关键结果" />
      <el-table-column prop="keyWeight" label="KR权重" width="80"/>
      <el-table-column prop="score" label="评分" />
    </el-table>
</template>

<script setup>
import {ref, onBeforeMount, reactive,getCurrentInstance} from "vue";
import {getEmpPositionOkr}from '@/api/okr'
import {addEmpOkr} from '@/api/empOkr'
import { ElMessage } from 'element-plus'

let props = defineProps({
  empId: {
    type: String,
    required: true, //是否规定必须得有
  },
  update: {
    type: Function,
    default: () => {},
  },
  positionId:{
    type:Number,
    required:true
  },
  type:{
    type:Number,
    required:true
  }
})  
const tableData=ref([])
onBeforeMount(()=>{
  let assessorId=JSON.parse(localStorage.getItem('userInfo')).id;
  let empId=props.empId;
  let positionId=props.positionId;
  let positionType=props.type
    getEmpPositionOkr({assessorId,empId,positionId,positionType})
    .then(data=>{
        tableData.value=data.data;
    });
})
</script>
<style lang="scss" scoped>
.button{
        width: 120px;
        height: 40px;
        margin: 10px 130px;
        float: right;
    }
</style>
